/*
 * @Author: June
 * @Date: 2022-11-14 14:40:09
 * @LastEditors: 无处安放的六月
 * @LastEditTime: 2023-11-30 11:05:44
 * @Description:
 *
 */
import Cookies from 'js-cookie'

const TokenKey = `wisdomapp_token`
const compName = 'wisdomapp_comp'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

/**
 * @description:  是否是管理员账号 增删改查
 * @return {*}
 */
export function getIsAdmin() {
  return Cookies.get('isadmin') === 'true'
}

export function setIsAdmin(isadmin) {
  return Cookies.set('isadmin', isadmin)
}

export function removeIsAdmin() {
  return Cookies.remove('isadmin')
}

/**
 * @description:  公司信息增删改查
 * @param {*} params
 * @return {*}
 */
export function setCompInfo(params) {
  return Cookies.set(compName, JSON.stringify(params))
}

export function getCompInfo() {
  return Cookies.get(compName) ? JSON.parse(Cookies.get(compName)) : {}
}

export function removeCompInfo() {
  {
    return Cookies.remove(compName)
  }
}
